package com.example.myapplication;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Fragment3 extends Fragment {
    RecyclerView recyclerView;
    List<Map<String, Object>> list3;
    Myadapter3  myadapter;
    Context fragmentContext;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.tab3, container, false);
        recyclerView = view.findViewById(R.id.recyclerView3);

        int[] picture = {R.drawable.pf1, R.drawable.pf2, R.drawable.pf3, R.drawable.pf4, R.drawable.pf5, R.drawable.pf6, R.drawable.pf7};
        String text3 = new String();
        list3 = new ArrayList<>();
        for (int i = 0; i < picture.length; i++) {
            Map<String, Object> map = new HashMap<>();
            map.put("picture", picture[i]);
            map.put("text", text3);
            list3.add(map);
        }

        fragmentContext = getContext();
        myadapter = new Myadapter3(getContext(),list3);
        RecyclerView.LayoutManager manager = new LinearLayoutManager(fragmentContext);
        recyclerView.setLayoutManager(manager);
        recyclerView.setAdapter(myadapter);



        return view;
    }
}